//
//  RightTableViewCell.swift
//  hangge_2258
//
//  Created by hangge on 2019/1/8.
//  Copyright © 2019年 hangge. All rights reserved.
//

import UIKit

//右侧表格的自定义单元格
class SSRightTableViewCell: UITableViewCell {
    
    //标题文本标签
    var titleLabel = UILabel()
    
    var checkImageV = UIImageView()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        selectionStyle = .none
    
        //初始化标题文本标签
        titleLabel.frame = CGRect(x: 16, y: 10, width: 200, height: 30)
        titleLabel.font = UIFont.systemFont(ofSize: 16)
        contentView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { make in
            make.left.equalTo(16)
            make.centerY.equalToSuperview()
            make.width.equalTo(200)
            make.height.equalTo(30)
        }
        
        contentView.addSubview(checkImageV)
        checkImageV.image = UIImage(named: "check_mark")
        checkImageV.snp.makeConstraints { make in
            make.right.equalToSuperview().offset(-16)
            make.centerY.equalToSuperview()
            make.width.equalTo(20)
            make.height.equalTo(20)
        }
    }
    
    //设置数据
    func setData(_ model : SSOrderTimeSub) {
        titleLabel.text = model.durationTime
        if(model.isSeat){
            contentView.backgroundColor = UIColor(hex: "#5C3BEE")?.withAlphaComponent(0.05)
            titleLabel.textColor = UIColor.themeColor
        }else{
            contentView.backgroundColor = UIColor.white
            titleLabel.textColor = UIColor.black
        }
        checkImageV.isHidden = !model.isSeat
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
